package com.njit;
/**
 * Created by ospip on 2017/11/16.
 * Copyright (c) 2017 LLAP. All rights reserved.
 */

import java.awt.*;
import javax.swing.*;

public class HelloWorld extends JFrame {

    private JMenuBar menubar;
    private JMenu menu1;
    private JMenuItem m11;
    private JMenuItem m12;
    private JMenu menu2;
    private JMenuItem m21, m22, m23, m24;
    private JButton b1, b2;
    private JToolBar tool;

    public HelloWorld() {
        super();
        this.setSize(400, 300);
        this.setTitle("HelloWorld");
        this.setLocationRelativeTo(getOwner());
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        // Begin

        menu1 = new JMenu("系统");
        m11 = new JMenuItem("用户管理");
        m12 = new JMenuItem();
        m12.setText("退出");
        menu1.add(m11); menu1.add(m12);

        menu2 = new JMenu("数据操作");
        m21 = new JMenuItem("Query");
        m22 = new JMenuItem("Add");
        m23 = new JMenuItem("Alter");
        m24 = new JMenuItem("Delete");
        menu2.add(m21); menu2.add(m22); menu2.add(m23); menu2.add(m24);

        menubar = new JMenuBar();
        menubar.add(menu1);
        menubar.add(menu2);

        setJMenuBar(menubar);

        b1 = new JButton("Query");
        b1.setFocusable(false);
        b1.setHorizontalTextPosition(SwingConstants.CENTER);
        b1.setVerticalTextPosition(SwingConstants.BOTTOM);
        b2 = new JButton("Add");
        b2.setFocusable(false);;
        b2.setHorizontalTextPosition(SwingConstants.CENTER);
        b2.setVerticalTextPosition(SwingConstants.BOTTOM);

        tool = new JToolBar();
        tool.add(b1);
        tool.add(b2);
        tool.setRollover(true);
        this.add(tool, BorderLayout.PAGE_START);
        // End

    }
    public static void main(String[] args) {
        HelloWorld w = new HelloWorld();
        w.setVisible(true);

    }

}